using UnityEngine;
using System.Collections;

public class ButtonOpen : MonoBehaviour
{
	
	public string target;
	public UIManagement.WindowAnchor anchorType = UIManagement.WindowAnchor.Left;
	
	GameObject windowTarget;

	// Use this for initialization
	void Start ()
	{
		//TODO
		//Find target from UI
		
		
	}
	
	// Update is called once per frame
	void Update ()
	{
	
	}
	
	void OnClick ()
	{
		if (windowTarget == null) {
			windowTarget = UIManagement.Instance().OpenWindow(target,anchorType);
		} else {
			if(windowTarget.activeInHierarchy){
				UIManagement.Instance().CloseWindow(windowTarget);
			} else {
				windowTarget = UIManagement.Instance().OpenWindow(target,anchorType);
			}
		}
	}
}
